package com.platform.toutiao.error;


public enum TouTiaoErrorMsgEnum {
	
	CODE_0(0, "请求成功"),
	CODE_1(-1, "系统错误"),
	CODE_40015(40015, "appid 错误"),
	CODE_40017(40017, "secret 错误"),
	CODE_40018(40018, "code 错误"),
	CODE_40019(40019, "acode 错误");
	
	private int code;
	private String msg;

	TouTiaoErrorMsgEnum(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	/**
	 * 通过错误代码查找其中文含义..
	 */
	public static String findMsgByCode(int code) {
		for (TouTiaoErrorMsgEnum value : TouTiaoErrorMsgEnum.values()) {
			if (value.code == code) {
				return value.msg;
			}
		}

		return null;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
}
